package com.sky.mapper.admin;

import com.github.pagehelper.Page;
import com.sky.autoFill.AutoFill;
import com.sky.dto.SetmealDTO;
import com.sky.dto.SetmealPageQueryDTO;
import com.sky.enumeration.OperationType;
import com.sky.pojo.Setmeal;
import com.sky.vo.DishVO;
import com.sky.vo.SetmealVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;
import java.util.Map;

@Mapper
public interface SetmealMapper {

    /**
     * 根据分类id查询套餐的数量
     * @param id
     * @return
     */
    @Select("select count(id) from setmeal where category_id = #{categoryId}")
    Integer countByCategoryId(Long id);


    Page<SetmealVO> pageFind(SetmealPageQueryDTO dto);

    List<DishVO> findByCategoryId(Long categoryId);

    int findByName(String name);

    @AutoFill(OperationType.INSERT)
    void save(Setmeal dto);

    void delete(List<Integer> ids);

    Integer findStatusByIds(List<Integer> ids);


    Setmeal selectById(Long id);
@AutoFill(OperationType.UPDATE)
    void put(Setmeal setmeal);

    void putStatusById(Integer status, Long id);

    Map<String, Object> selectBystatus();
}
